home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1993 April: Penguin on DISC / ADC Developer CD (1993-04) (''Penguin On DISC'')_iso / Dev.CD Apr 93.iso / Utilities / MPW Interfaces 7.1 Beta / PInterfaces / Printing.p < prev    next >
Encoding:
Text File  |  1992-08-28  |  10.3 KB  |  396 lines  |  [TEXT/MPS ]

  1.  
  2. {
  3. Created: Saturday, July 27, 1991 at 10:35 PM
  4.  Printing.p
  5.  Pascal Interface to the Macintosh Libraries
  6.  
  7.   Copyright Apple Computer, Inc. 1985-1991
  8.   All rights reserved
  9.  
  10. *** Warning: This is an alpha version of the Interfaces for Cube-E. 
  11. ***          Things may change.  Caveat Programmer.
  12.  
  13.  
  14. }
  15.  
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Printing;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED UsingPrinting}
  27. {$SETC UsingPrinting := 1}
  28.  
  29. {$I+}
  30. {$SETC PrintingIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32. {$IFC UNDEFINED UsingQuickdraw}
  33. {$I $$Shell(PInterfaces)Quickdraw.p}
  34. {$ENDC}
  35. {$IFC UNDEFINED UsingDialogs}
  36. {$I $$Shell(PInterfaces)Dialogs.p}
  37. {$ENDC}
  38. {$SETC UsingIncludes := PrintingIncludes}
  39.  
  40. CONST
  41. iPFMaxPgs = 128;
  42. iPrPgFract = 120;                        {Page scale factor. ptPgSize (below) is in units of 1/iPrPgFract}
  43. iPrPgFst = 1;                            {Page range constants}
  44. iPrPgMax = 9999;
  45. iPrRelease = 3;                            {Current version number of the code.}
  46. iPrSavPFil = -1;
  47. iPrAbort = $0080;
  48. iPrDevCtl = 7;                            {The PrDevCtl Proc's ctl number}
  49. lPrReset = $00010000;                    {The PrDevCtl Proc's CParam for reset}
  50. lPrLineFeed = $00030000;
  51. lPrLFStd = $0003FFFF;                    {The PrDevCtl Proc's CParam for std paper advance}
  52. lPrLFSixth = $0003FFFF;
  53. lPrPageEnd = $00020000;                    {The PrDevCtl Proc's CParam for end page}
  54. lPrDocOpen = $00010000;
  55. lPrPageOpen = $00040000;
  56. lPrPageClose = $00020000;
  57. lPrDocClose = $00050000;
  58. iFMgrCtl = 8;                            {The FMgr's Tail-hook Proc's ctl number}
  59. iMscCtl = 9;                            {The FMgr's Tail-hook Proc's ctl number}
  60. iPvtCtl = 10;                            {The FMgr's Tail-hook Proc's ctl number}
  61. iMemFullErr = -108;
  62. iIOAbort = -27;
  63. pPrGlobals = $00000944;                    {The PrVars lo mem area:}
  64. bDraftLoop = 0;
  65. bSpoolLoop = 1;
  66. bUser1Loop = 2;
  67. bUser2Loop = 3;
  68. fNewRunBit = 2;
  69. fHiResOK = 3;
  70. fWeOpenedRF = 4;
  71.  
  72. {Driver constants }
  73. iPrBitsCtl = 4;
  74. lScreenBits = 0;
  75. lPaintBits = 1;
  76. lHiScreenBits = $00000002;                {The Bitmap Print Proc's Screen Bitmap param}
  77. lHiPaintBits = $00000003;                {The Bitmap Print Proc's Paint [sq pix] param}
  78. iPrIOCtl = 5;
  79. iPrEvtCtl = 6;                            {The PrEvent Proc's ctl number}
  80. lPrEvtAll = $0002FFFD;                    {The PrEvent Proc's CParam for the entire screen}
  81. lPrEvtTop = $0001FFFD;                    {The PrEvent Proc's CParam for the top folder}
  82. iPrDrvrRef = -3;
  83. getRslDataOp = 4;
  84. setRslOp = 5;
  85. draftBitsOp = 6;
  86. noDraftBitsOp = 7;
  87. getRotnOp = 8;
  88. NoSuchRsl = 1;
  89. OpNotImpl = 2;                            {the driver doesn't support this opcode}
  90. RgType1 = 1;
  91.  
  92. TYPE
  93. TFeed = (feedCut,feedFanfold,feedMechCut,feedOther);
  94.  
  95. TScan = (scanTB,scanBT,scanLR,scanRL);
  96.  
  97.  
  98. TPRect = ^Rect;                            { A Rect Ptr }
  99. PrIdleProcPtr = ProcPtr;
  100. PItemProcPtr = ProcPtr;
  101.  
  102. TPPrPort = ^TPrPort;
  103. TPrPort = RECORD
  104.  gPort: GrafPort;                        {The Printer's graf port.}
  105.  gProcs: QDProcs;                        {..and its procs}
  106.  lGParam1: LONGINT;                        {16 bytes for private parameter storage.}
  107.  lGParam2: LONGINT;
  108.  lGParam3: LONGINT;
  109.  lGParam4: LONGINT;
  110.  fOurPtr: BOOLEAN;                        {Whether the PrPort allocation was done by us.}
  111.  fOurBits: BOOLEAN;                        {Whether the BitMap allocation was done by us.}
  112.  END;
  113.  
  114. { Printing Graf Port. All printer imaging, whether spooling, banding, etc, happens "thru" a GrafPort.
  115.   This is the "PrPeek" record. }
  116. TPPrInfo = ^TPrInfo;
  117. TPrInfo = RECORD
  118.  iDev: INTEGER;                            {Font mgr/QuickDraw device code}
  119.  iVRes: INTEGER;                        {Resolution of device, in device coordinates}
  120.  iHRes: INTEGER;                        {..note: V before H => compatable with Point.}
  121.  rPage: Rect;                            {The page (printable) rectangle in device coordinates.}
  122.  END;
  123.  
  124. { Print Info Record: The parameters needed for page composition. }
  125. TPPrStl = ^TPrStl;
  126. TPrStl = RECORD
  127.  wDev: INTEGER;
  128.  iPageV: INTEGER;
  129.  iPageH: INTEGER;
  130.  bPort: SignedByte;
  131.  feed: TFeed;
  132.  END;
  133.  
  134. TPPrXInfo = ^TPrXInfo;
  135. TPrXInfo = RECORD
  136.  iRowBytes: INTEGER;
  137.  iBandV: INTEGER;
  138.  iBandH: INTEGER;
  139.  iDevBytes: INTEGER;
  140.  iBands: INTEGER;
  141.  bPatScale: SignedByte;
  142.  bUlThick: SignedByte;
  143.  bUlOffset: SignedByte;
  144.  bUlShadow: SignedByte;
  145.  scan: TScan;
  146.  bXInfoX: SignedByte;
  147.  END;
  148.  
  149. TPPrJob = ^TPrJob;
  150. TPrJob = RECORD
  151.  iFstPage: INTEGER;                        {Page Range.}
  152.  iLstPage: INTEGER;
  153.  iCopies: INTEGER;                        {No. copies.}
  154.  bJDocLoop: SignedByte;                    {The Doc style: Draft, Spool, .., and ..}
  155.  fFromUsr: BOOLEAN;                        {Printing from an User's App (not PrApp) flag}
  156.  pIdleProc: PrIdleProcPtr;                {The Proc called while waiting on IO etc.}
  157.  pFileName: StringPtr;                    {Spool File Name: NIL for default.}
  158.  iFileVol: INTEGER;                        {Spool File vol, set to 0 initially}
  159.  bFileVers: SignedByte;                    {Spool File version, set to 0 initially}
  160.  bJobX: SignedByte;                        {An eXtra byte.}
  161.  END;
  162.  
  163. TPrFlag1 = PACKED RECORD
  164.  f15: BOOLEAN;
  165.  f14: BOOLEAN;
  166.  f13: BOOLEAN;
  167.  f12: BOOLEAN;
  168.  f11: BOOLEAN;
  169.  f10: BOOLEAN;
  170.  f9: BOOLEAN;
  171.  f8: BOOLEAN;
  172.  f7: BOOLEAN;
  173.  f6: BOOLEAN;
  174.  f5: BOOLEAN;
  175.  f4: BOOLEAN;
  176.  f3: BOOLEAN;
  177.  f2: BOOLEAN;
  178.  fLstPgFst: BOOLEAN;
  179.  fUserScale: BOOLEAN;
  180.  END;
  181.  
  182. { Print Job: Print "form" for a single print request. }
  183. TPPrint = ^TPrint;
  184. THPrint = ^TPPrint;
  185. TPrint = RECORD
  186.  iPrVersion: INTEGER;                    {(2) Printing software version}
  187.  prInfo: TPrInfo;                        {(14) the PrInfo data associated with the current style.}
  188.  rPaper: Rect;                            {(8) The paper rectangle [offset from rPage]}
  189.  prStl: TPrStl;                            {(8)  This print request's style.}
  190.  prInfoPT: TPrInfo;                        {(14)  Print Time Imaging metrics}
  191.  prXInfo: TPrXInfo;                        {(16)  Print-time (expanded) Print info record.}
  192.  prJob: TPrJob;                            {(20) The Print Job request (82)  Total of the above; 120-82 = 38 bytes needed to fill 120}
  193.  CASE INTEGER OF
  194.    0:
  195.   (printX: ARRAY [1..19] OF INTEGER);
  196.    1:
  197.   (prFlag1: TPrFlag1;                   {a word of flags}
  198.   iZoomMin: INTEGER;
  199.   iZoomMax: INTEGER;
  200.   hDocName: StringHandle);                 {current doc's name, nil = front window}
  201.  END;
  202.  
  203. { The universal 120 byte printing record }
  204. TPPrStatus = ^TPrStatus;
  205. TPrStatus = RECORD
  206.  iTotPages: INTEGER;                    {Total pages in Print File.}
  207.  iCurPage: INTEGER;                        {Current page number}
  208.  iTotCopies: INTEGER;                    {Total copies requested}
  209.  iCurCopy: INTEGER;                        {Current copy number}
  210.  iTotBands: INTEGER;                    {Total bands per page.}
  211.  iCurBand: INTEGER;                        {Current band number}
  212.  fPgDirty: BOOLEAN;                        {True if current page has been written to.}
  213.  fImaging: BOOLEAN;                        {Set while in band's DrawPic call.}
  214.  hPrint: THPrint;                        {Handle to the active Printer record}
  215.  pPrPort: TPPrPort;                        {Ptr to the active PrPort}
  216.  hPic: PicHandle;                        {Handle to the active Picture}
  217.  END;
  218.  
  219. { Print Status: Print information during printing. }
  220. TPPfPgDir = ^TPfPgDir;
  221. THPfPgDir = ^TPPfPgDir;
  222. TPfPgDir = RECORD
  223.  iPages: INTEGER;
  224.  iPgPos: ARRAY [0..128] OF LONGINT;        {ARRAY [0..iPfMaxPgs] OF LONGINT}
  225.  END;
  226.  
  227. { PicFile = a TPfHeader followed by n QuickDraw Pics (whose PicSize is invalid!) }
  228. TPPrDlg = ^TPrDlg;
  229. TPrDlg = RECORD
  230.  Dlg: DialogRecord;                        {The Dialog window}
  231.  pFltrProc: ModalFilterProcPtr;            {The Filter Proc.}
  232.  pItemProc: PItemProcPtr;                {The Item evaluating proc.}
  233.  hPrintUsr: THPrint;                    {The user's print record.}
  234.  fDoIt: BOOLEAN;
  235.  fDone: BOOLEAN;
  236.  lUser1: LONGINT;                        {Four longs for user's to hang global data.}
  237.  lUser2: LONGINT;                        {...Plus more stuff needed by the particular printing dialog.}
  238.  lUser3: LONGINT;
  239.  lUser4: LONGINT;
  240.  END;
  241.  
  242.  
  243. PDlgInitProcPtr = ProcPtr;
  244.  
  245. TGnlData = RECORD
  246.  iOpCode: INTEGER;
  247.  iError: INTEGER;
  248.  lReserved: LONGINT;                    {more fields here depending on call}
  249.  END;
  250.  
  251. TRslRg = RECORD
  252.  iMin: INTEGER;
  253.  iMax: INTEGER;
  254.  END;
  255.  
  256. TRslRec = RECORD
  257.  iXRsl: INTEGER;
  258.  iYRsl: INTEGER;
  259.  END;
  260.  
  261. TGetRslBlk = RECORD
  262.  iOpCode: INTEGER;
  263.  iError: INTEGER;
  264.  lReserved: LONGINT;
  265.  iRgType: INTEGER;
  266.  xRslRg: TRslRg;
  267.  yRslRg: TRslRg;
  268.  iRslRecCnt: INTEGER;
  269.  rgRslRec: ARRAY [1..27] OF TRslRec;
  270.  END;
  271.  
  272. TSetRslBlk = RECORD
  273.  iOpCode: INTEGER;
  274.  iError: INTEGER;
  275.  lReserved: LONGINT;
  276.  hPrint: THPrint;
  277.  iXRsl: INTEGER;
  278.  iYRsl: INTEGER;
  279.  END;
  280.  
  281. TDftBitsBlk = RECORD
  282.  iOpCode: INTEGER;
  283.  iError: INTEGER;
  284.  lReserved: LONGINT;
  285.  hPrint: THPrint;
  286.  END;
  287.  
  288. TGetRotnBlk = RECORD
  289.  iOpCode: INTEGER;
  290.  iError: INTEGER;
  291.  lReserved: LONGINT;
  292.  hPrint: THPrint;
  293.  fLandscape: BOOLEAN;
  294.  bXtra: SignedByte;
  295.  END;
  296.  
  297. TPBitMap = ^BitMap;                        { A BitMap Ptr }
  298.  
  299. TN = 0..15;                                { a Nibble }
  300.  
  301. TPWord = ^TWord;
  302. THWord = ^TPWord;
  303. TWord = PACKED RECORD
  304.  CASE INTEGER OF
  305.    0:
  306.   (c1,c0: CHAR);
  307.    1:
  308.   (b1,b0: SignedByte);
  309.    2:
  310.   (usb1,usb0: Byte);
  311.    3:
  312.   (n3,n2,n1,n0: TN);
  313.    4:
  314.   (f15,f14,f13,f12,f11,f10,f9,f8,f7,f6,f5,f4,f3,f2,f1,f0: BOOLEAN);
  315.    5:
  316.   (i0: INTEGER);
  317.  END;
  318.  
  319. TPLong = ^TLong;
  320. THLong = ^TPLong;
  321. TLong = RECORD
  322.  CASE INTEGER OF
  323.    0:
  324.   (w1,w0: TWord);
  325.    1:
  326.   (b1,b0: LONGINT);
  327.    2:
  328.   (p0: Ptr);
  329.    3:
  330.   (h0: Handle);
  331.    4:
  332.   (pt: Point);
  333.  END;
  334.  
  335.  
  336. PROCEDURE PrPurge;
  337.  INLINE $2F3C,$A800,$0000,$A8FD;
  338. PROCEDURE PrNoPurge;
  339.  INLINE $2F3C,$B000,$0000,$A8FD;
  340. PROCEDURE PrOpen;
  341.  INLINE $2F3C,$C800,$0000,$A8FD;
  342. PROCEDURE PrClose;
  343.  INLINE $2F3C,$D000,$0000,$A8FD;
  344. PROCEDURE PrintDefault(hPrint: THPrint);
  345.  INLINE $2F3C,$2004,$0480,$A8FD;
  346. FUNCTION PrValidate(hPrint: THPrint): BOOLEAN;
  347.  INLINE $2F3C,$5204,$0498,$A8FD;
  348. FUNCTION PrStlDialog(hPrint: THPrint): BOOLEAN;
  349.  INLINE $2F3C,$2A04,$0484,$A8FD;
  350. FUNCTION PrJobDialog(hPrint: THPrint): BOOLEAN;
  351.  INLINE $2F3C,$3204,$0488,$A8FD;
  352. FUNCTION PrStlInit(hPrint: THPrint): TPPrDlg;
  353.  INLINE $2F3C,$3C04,$040C,$A8FD;
  354. FUNCTION PrJobInit(hPrint: THPrint): TPPrDlg;
  355.  INLINE $2F3C,$4404,$0410,$A8FD;
  356. PROCEDURE PrJobMerge(hPrintSrc: THPrint;hPrintDst: THPrint);
  357.  INLINE $2F3C,$5804,$089C,$A8FD;
  358. FUNCTION PrDlgMain(hPrint: THPrint;pDlgInit: PDlgInitProcPtr): BOOLEAN;
  359.  INLINE $2F3C,$4A04,$0894,$A8FD;
  360. FUNCTION PrOpenDoc(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr): TPPrPort;
  361.  INLINE $2F3C,$0400,$0C00,$A8FD;
  362. PROCEDURE PrCloseDoc(pPrPort: TPPrPort);
  363.  INLINE $2F3C,$0800,$0484,$A8FD;
  364. PROCEDURE PrOpenPage(pPrPort: TPPrPort;pPageFrame: TPRect);
  365.  INLINE $2F3C,$1000,$0808,$A8FD;
  366. PROCEDURE PrClosePage(pPrPort: TPPrPort);
  367.  INLINE $2F3C,$1800,$040C,$A8FD;
  368. PROCEDURE PrPicFile(hPrint: THPrint;pPrPort: TPPrPort;pIOBuf: Ptr;pDevBuf: Ptr;
  369.  VAR prStatus: TPrStatus);
  370.  INLINE $2F3C,$6005,$1480,$A8FD;
  371. FUNCTION PrError: INTEGER;
  372.  INLINE $2F3C,$BA00,$0000,$A8FD;
  373. PROCEDURE PrSetError(iErr: INTEGER);
  374.  INLINE $2F3C,$C000,$0200,$A8FD;
  375. PROCEDURE PrGeneral(pData: Ptr);
  376.  INLINE $2F3C,$7007,$0480,$A8FD;
  377. PROCEDURE PrDrvrOpen;
  378.  INLINE $2F3C,$8000,$0000,$A8FD;
  379. PROCEDURE PrDrvrClose;
  380.  INLINE $2F3C,$8800,$0000,$A8FD;
  381. PROCEDURE PrCtlCall(iWhichCtl: INTEGER;lParam1: LONGINT;lParam2: LONGINT;
  382.  lParam3: LONGINT);
  383.  INLINE $2F3C,$A000,$0E00,$A8FD;
  384. FUNCTION PrDrvrDCE: Handle;
  385.  INLINE $2F3C,$9400,$0000,$A8FD;
  386. FUNCTION PrDrvrVers: INTEGER;
  387.  INLINE $2F3C,$9A00,$0000,$A8FD;
  388.  
  389.  
  390. {$ENDC} { UsingPrinting }
  391.  
  392. {$IFC NOT UsingIncludes}
  393.  END.
  394. {$ENDC}
  395.  
  396.